<?php
use think\facade\Route;

// 无需验证
Route::group('app',function() {
    //文件上传公共接口
    Route::group('uploads', function () {
        //
        Route::post('files','Uploads/files');
        Route::post('by_id','Uploads/byId');
    });

    //配置接口
    Route::group('configs', function () {
        Route::get('check_update','Configs/checkUpdateV2');
    });

    //收货地址选择
    Route::group('areas', function () {
        //选择
        Route::post('picker', 'Areas/picker');
        Route::post('lists', 'Areas/lists');
    });

    Route::group('msg', function () {
        //发送验证码
        Route::post('send_code','Msg/sendCode');
    });

    Route::group('oauth', function () {
        //登录页信息
        Route::post('information', 'Oauth/information');
        //手机验证码登录
        Route::post('mobile_login','Oauth/mobileLogin');
        //账号密码登录
        Route::post('login','Oauth/login');
    });

    //注册相关路由
    Route::group('register', function () {
        //注册数据
        Route::get('information', 'Register/information');
        //提交注册
        Route::post('action', 'Register/action');
    });

    //首页相关信息
    Route::group('index', function () {
        //首页信息
        Route::post('information', 'Index/information');
    });

    //商品相关信息
    Route::group('goods', function () {
        //商品详情
        Route::get('detail', 'Goods/detail');
        //全部信息
        Route::get('categories', 'Goods/categories');
        //商品列表
        Route::get('lists_information', 'Goods/listsInformation');
    });



//    Route::get('index/oauth_information', 'Register/registerData');


    Route::group('goods_category', function () {
        //分类相关信息
        //信息页
        Route::get('information', 'GoodsCategory/information');
    });


    //用户信息
//    Route::post('user/login', 'User/login');
//    Route::post('user/mobile_login', 'User/mobileLogin');
    //用户相关路由
//    Route::group('user', function () {
//        //用户信息
//        Route::post('login', 'User/login');
//        Route::post('mobile_login', 'User/mobileLogin');
//        //用户信息
////        Route::post('information', 'User/information');
////        //邀请好友
////        Route::get('invite_information', 'User/inviteInformation');
////
////        Route::get('wallets/information', 'User/walletsInformation');
//    });





    //模式相关信息
//    Route::group('mode_product', function () {
//
////        //全部信息
////        Route::get('categories', 'Goods/categories');
//        //模式列表信息
//        Route::get('lists_information', 'ModeProduct/listsInformation');
//        //模式列表
//        Route::post('lists', 'ModeProduct/lists');
//        //商品详情
//        Route::get('detail', 'ModeProduct/detail');
//    });
//


})->middleware(\app\middleware\AllowCrossDomain::class);

//需要验证
Route::group('app',function() {
    //购物车相关信息
    Route::group('cart', function () {
        //加入购物车
        Route::post('add', 'Cart/add');
        //修改数量
        Route::post('number', 'Cart/number');
        //购物车
        Route::get('information', 'Cart/information');
        //购物车结算
        Route::get('settlement/information', 'Cart/settlementInformation');

        //加入模式购物车
        Route::post('mode_add', 'Cart/modeAdd');
        //模式购物车信息
        Route::get('mode_information', 'Cart/modeInformation');
        //模式购物车结算
        Route::get('mode_settlement_information', 'Cart/modeSettlementInformation');
    });
    //订单相关信息
    Route::group('orders', function () {
        //创建订单
        Route::post('create', 'Orders/create');

        //订单列表
        Route::get('information', 'Orders/information');
        //获取订单列表
        Route::post('lists', 'Orders/lists');

        //订单详情
        Route::get('detail_information', 'Orders/detailInformation');
    });

    Route::group('settings', function () {
        //
        Route::get('information', 'Settings/information');


    });

    //用户信息
//    Route::post('user/information', 'User/information');
    //用户相关路由
    Route::group('user', function () {
        //用户信息
        Route::post('information', 'User/information');
        //邀请好友
        Route::post('invite_information', 'User/inviteInformation');

        Route::post('edit_password', 'User/editPassword');

        Route::post('edit_pay_password', 'User/editPayPassword');

        Route::get('open_member_information', 'User/openMemberInformation');

        Route::post('open_member_action', 'User/openMemberAction');

        Route::get('open_merchant_information', 'User/openMerchantInformation');

        Route::post('open_merchant_action', 'User/openMerchantAction');




        //实名认证
        Route::post('certification_information', 'User/certificationInformation');
        //团队管理
        Route::get('teams_information', 'User/teamsInformation');
        Route::post('teams_lists', 'User/teamsLists');
        //众益健康设置
        Route::get('settings_information', 'User/settingsInformation');


        //钱包记录
        Route::get('wallets_information', 'User/walletsInformation');
        //通用信息查询
        Route::post('wallets', 'User/logInformation');
        //余额记录
        Route::post('balance_log', 'UserBalanceLog/lists');
        //消费积分记录
        Route::post('integral_log', 'UserIntegralLog/lists');
        //绿色积分记录
        Route::post('green_points_log', 'UserGreenPointsLog/lists');
//        transfers
        //转账信息
        Route::post('balance_transfers_information', 'User/balanceTransfersInformation');
        //确认转账
        Route::post('balance_transfers_action', 'User/balanceTransfersAction');
        //提现信息
        Route::get('withdrawals_information', 'User/withdrawalsInformation');
        //提现请求
        Route::post('withdrawals_apply', 'User/withdrawalsApply');

        Route::post('settings', 'User/settings');

        //合伙人
        Route::get('partner_information', 'User/partnerInformation');
    });

    Route::group('user_address', function () {
        //收货地址
        //保存地址
        Route::post('store', 'UserAddress/store');
        //收货地址
//        Route::group('addresses', function () {
//            //获取列表
//            Route::post('lists', 'User/addressLists');
//            //保存地址
//            Route::post('store', 'User/addressStore');
//        });
    });

    //购物车相关信息
    Route::group('teams', function () {
        //购物车
        Route::get('information', 'Teams/information');

        Route::post('lists', 'Teams/lists');

        Route::get('size_zone', 'Teams/sizeZone');
    });

    Route::group('user_score', function () {
        //
        Route::get('information', 'UserScore/information');
        //
        Route::post('transfer_information', 'UserScore/transferInformation');
        //
        Route::post('transfer_action', 'UserScore/transferAction');
        //
        Route::get('withdrawals_information', 'UserScore/withdrawalsInformation');
        //
        Route::post('withdrawals_apply', 'UserScore/withdrawalsApply');
        //用户信息
        Route::get('logs', 'UserScore/logs');
        //邀请好友
        Route::post('logs', 'UserScore/logs');
    });

    //收银台相关信息
    Route::group('payments', function () {
        //普通
        Route::post('information', 'Payments/information');
        //普通提交
        Route::post('method', 'Payments/method');
        //模式
        Route::post('mode_information', 'Payments/modeInformation');
        //模式提交
        Route::post('mode_method', 'Payments/modeMethod');
    });

    Route::group('merchant', function () {
        //
        Route::get('information', 'Merchant/information');
        //
        Route::post('activation_lists', 'Merchant/activationLists');
        //
        Route::get('exchange_information', 'Merchant/exchangeInformation');
        //
        Route::post('exchange_action', 'Merchant/exchangeAction');
        //
        Route::get('franchise_information', 'Merchant/franchiseInformation');
        //
        Route::post('franchise_lists', 'Merchant/franchiseLists');
    });








    //模式订单相关信息
    Route::group('mode_orders', function () {
        //创建订单
        Route::post('create', 'ModeOrders/create');
        //订单列表
        Route::get('information', 'ModeOrders/information');
        //获取订单列表
        Route::post('lists', 'ModeOrders/lists');
        //订单详情
        Route::get('detail_information', 'Orders/detailInformation');
    });

    //商户相关信息
    Route::group('merchant', function () {
        //商户个人中心页信息
        Route::get('', 'Merchant/information');
        //邀请码页信息
        Route::get('invite_information', 'Merchant/inviteInformation');
    });
    Route::group('merchant_orders', function () {
        //创建订单
        Route::post('create', 'MerchantOrders/create');

        Route::post('settlement_information', 'MerchantOrders/settlementInformation');
        //
        Route::get('cashier_information', 'MerchantOrders/cashierInformation');
        //模式提交
        Route::post('method', 'MerchantOrders/method');
    });
})->middleware([
    \app\middleware\AllowCrossDomain::class,
    \app\middleware\checkUserToken::class
]);